<?php
namespace app\controller\admin;

use core\controller\AdminBase;
use app\bll\User as BllUser;
use Exception;

class Personal extends AdminBase
{
    public function changepwd()
    {
        if (is_post()) {

            try {
                $data = request()->post();
                $bllUser = new BllUser();
                $bllUser->changePwd(
                    $data['oldpwd'],
                    $data['newpwd'],
                    $data['renewpwd'],
                    request()->admininfo['id']
                );
            } catch (Exception $ex) {
                return $this->error($ex->getMessage());
            }
            return $this->success();
        } else {
            return $this->view(frame: false);
        }
    }
}